package behavioral.observer;

import java.util.Observable;
import java.util.Observer;


public class JavaObserver extends Observable {
	private int i;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		JavaObserver s = new JavaObserver();
		DigitalObserver o1 = new DigitalObserver();
		s.addObserver(o1);
		s.setI(2);
//		s.setChanged();
		System.out.println(s.hasChanged());
		s.notifyObservers();
	}

	public int getI() {
		return i;
	}

	public void setI(int i) {
		setChanged();
		this.i = i;
	}
}

class DigitalObserver implements Observer {

	public void update(Observable o, Object arg) {
		System.out.println("digitobserver");
	}

}

